<!DOCTYPE html>
<link rel="stylesheet" type="text/css" href="__ADDONS__/SignIn/sign.css">

<div class="box1" id="checkdiv">

    <div class="row">

        <div class="col-md-2" style="float: left">

            <i class="glyphicon glyphicon-calendar calendar"></i>

        </div>

        <div class="col-md-6 row" style="float: left;margin-left:5px">

            <div class="col-md-6 dateinfo" >

                <div>{$check.week}</div>

                <div>{$check.day}</div>
            </div>


            <div class="col-md-6 checkinfo" >

                <div> DAYS </div>

                <div>{$connum} </div>

            </div>
        </div>


        <div style="padding-top:21px">

             <php>if($sign['issign']==1){</php>

                <span id="signin" class="btn-sign-h" style="font-size: 20px;padding-top: 10px">已签到</span>

             <php>}else{</php>

                <a href="javascript:void(0)" id="signin" onclick="signin()" class="btn-sign">签到</a>

             <php>}</php>

                <div class="sign-wrap" style="display:none" id="checkdetail">

                        <i class="arrow-y"></i>

                    <div class="sign-box" style="text-align: center">

                            <h3 id="checkinfo" style="font-size: 20px"><php>if($sign['issign']){</php>签到成功<php>}else{</php>未签到<php>}</php></h3>

                            <div><p>已连续签到<font id="con_num">{$connum}</font>天，累计签到<font id="total_num">{$totalnum}</font>天</p></div>

                     </div>
                </div>

        </div>

    </div>
</div>




<script>
    var isshow = 1;
    $(function (){
        <php>if($check['ischeck']){</php>
        $('#checkdetail').hover(function (){
            isshow = 2;
        },function (){
            setTimeout(function (){
                if(isshow==1){
                    $('#checkdetail').hide();
                }
                isshow = 1;
            },100);
        });
            $('#checkin').hover(function (){
                $('#checkdetail').show();
               
            },function (){
                setTimeout(function (){
                    if(isshow==1){
                        $('#checkdetail').hide();
                    }
                    isshow = 1;
                },100);
            });
        <php>}</php>
        $('#checkdetail').hover(function (){
            isshow = 2;
        },function (){
            setTimeout(function (){
                if(isshow==1){
                    $('#checkdetail').hide();
                }
                isshow = 1;
            },100);
        });
        $('#signin').hover(function (){
            $('#checkdetail').show();
        },function (){
            setTimeout(function (){
                if(isshow==1){
                    $('#checkdetail').hide();
                }
                isshow = 1;
            },100);
        });
    });

    function signin(){


        $('#signin').text('已签到');
        $('#signin').attr('onclick' , '');
        $('#signin').attr('class' , 'btn-sign-h');
       
        



        $.post("{:addons_url('SignIn://SignIn/sign_in')}" , {} , function (res){

            if ( res.errno == 0 ){
                var connum = res.content;
                $('#con_num').text(connum);
                $('#con_num_day').text(connum);
                $('#checkinfo').text('签到成功');
                if(res.score > 0){
                	showmsg('积分：+'+res.score);
                }
                
            }else{
            	showmsg(res.message);
            }
        
        });

    }
</script>
